package com.zhangfb95.crosschain.server.infra.data.converter;

import com.zhangfb95.crosschain.server.infra.model.controller.request.rpcuser.RpcUserAddReq;
import com.zhangfb95.crosschain.server.infra.model.mapper.entity.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author zhangfubing
 * @since 2023/10/19
 */
@Mapper(uses = AesNamed.class)
public interface UserConverter {

    UserConverter INSTANCE = Mappers.getMapper(UserConverter.class);

    @Mapping(source = "decryptedPassword", target = "password", qualifiedByName = "encryptPassword")
    User convert(RpcUserAddReq req);
}
